home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / lib / udev / check-ptp-camera < prev    next >
Text File  |  2008-09-23  |  497b  |  21 lines

  1. #!/bin/bash
  2.  
  3. # check if any interface of this device is a PTP camera interface (06)
  4. INTERFACE="${1:-06/01/01}"
  5.  
  6. BASENAME=${PHYSDEVPATH##*/}
  7. for d in /sys/${PHYSDEVPATH}/${BASENAME}:*; do
  8.     [[ -d ${d} ]] || continue
  9.     INTERFACEID="$(< ${d}/bInterfaceClass)"
  10.     INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceSubClass)"
  11.     INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceProtocol)"
  12.  
  13.     #echo ${d}: ${INTERFACEID}
  14.     if [[ ${INTERFACE} == ${INTERFACEID} ]]; then
  15.         # Found interface
  16.         exit 0
  17.     fi
  18. done
  19.  
  20. exit 1
  21.